<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GPL: inc/json/json.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="coffee_bean_77.268292682927px_1164279_easyicon.net.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">GPL
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="pages.html"><span>相关页面</span></a></li>
      <li><a href="namespaces.html"><span>命名空间</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>文件成员</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_bfccd401955b95cf8c75461437045ac0.html">inc</a></li><li class="navelem"><a class="el" href="dir_e79a1363056ef9b8f9a4d3e9bf13b031.html">json</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">json.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="json_8h.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="namespacegpl.html">   17</a></span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacegpl.html">gpl</a></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;{</div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="classgpl_1_1json.html">   51</a></span>&#160;    <span class="keyword">class </span><a class="code" href="classgpl_1_1json.html">json</a></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    {</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        <a class="code" href="classgpl_1_1json.html#a6a63d4da6102b133db62dde7196a9d31">json</a>();</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        <span class="keyword">virtual</span> <a class="code" href="classgpl_1_1json.html#a75318267cb1a99e8c027e14eac07dd8f">~json</a>();</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#ad7b6eb75816673fa59799f6e3b746a3f">parseJson</a>(std::string filename,<span class="keywordtype">int</span> encoded=0);</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        <span class="keywordtype">int</span> <a class="code" href="classgpl_1_1json.html#a70f6d21814412fcd39b0e375a65036c7">getArraySize</a>(std::string par);</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classgpl_1_1json.html#a22bb7bec211151a7e7ab7dfbc7b4698f">getItemDate</a>(<span class="keywordtype">int</span>&amp; date, std::string par);</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classgpl_1_1json.html#a22bb7bec211151a7e7ab7dfbc7b4698f">getItemDate</a>(std::string &amp;date, std::string par);</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classgpl_1_1json.html#a22bb7bec211151a7e7ab7dfbc7b4698f">getItemDate</a>(<span class="keywordtype">bool</span> &amp;date, std::string par);</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classgpl_1_1json.html#a22bb7bec211151a7e7ab7dfbc7b4698f">getItemDate</a>(<span class="keywordtype">double</span> &amp;date, std::string par);</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classgpl_1_1json.html#ac72f27ee752a5eafc33733423abcd71b">createJosn</a>(<span class="keywordtype">int</span> type);</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#ad21f79b3aec5cd85ae54ff5fa0c81ee8">addUnNameObject</a>(std::string par);</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#a9bba408957bfe134cde76ca012060ddb">addNameObject</a>(std::string par,<span class="keywordtype">char</span>* on);</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#a3ca90bb2f355760a46267eb8cee74a81">addNameArray</a>(std::string par,<span class="keywordtype">char</span>* an);</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#ac93597079b396af3190b5ccbce78b925">addItem</a>(std::string par, <span class="keywordtype">char</span>* n, <span class="keywordtype">char</span>* v);</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#ac93597079b396af3190b5ccbce78b925">addItem</a>(std::string par, <span class="keywordtype">char</span>* n, <span class="keywordtype">bool</span> v);</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#ac93597079b396af3190b5ccbce78b925">addItem</a>(std::string par, <span class="keywordtype">char</span>* n, <span class="keywordtype">double</span> v);</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#ac93597079b396af3190b5ccbce78b925">addItem</a>(std::string par, <span class="keywordtype">char</span>* n, <span class="keywordtype">int</span> v);</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#a1292cb00891eb064bcb11600debf917c">jsonToFile</a>(std::string filename);</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classgpl_1_1json.html#a39679378dbd5a4efaf7039b4610b7eaf">jsonToString</a>(std::string &amp;jsonsrc);</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;        std::string readFile(std::string filename);</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;        </div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;        <span class="keyword">class </span>LibJson;</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;        LibJson* m_json;</div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    };</div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;</div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;}</div><div class="ttc" id="namespacegpl_html"><div class="ttname"><a href="namespacegpl.html">gpl</a></div><div class="ttdef"><b>Definition:</b> <a href="json_8h_source.html#l00017">json.h:17</a></div></div>
<div class="ttc" id="classgpl_1_1json_html"><div class="ttname"><a href="classgpl_1_1json.html">gpl::json</a></div><div class="ttdoc">对josn操作的封装 </div><div class="ttdef"><b>Definition:</b> <a href="json_8h_source.html#l00051">json.h:51</a></div></div>
<div class="ttc" id="classgpl_1_1json_html_ac72f27ee752a5eafc33733423abcd71b"><div class="ttname"><a href="classgpl_1_1json.html#ac72f27ee752a5eafc33733423abcd71b">gpl::json::createJosn</a></div><div class="ttdeci">void createJosn(int type)</div><div class="ttdoc">创建json </div></div>
<div class="ttc" id="classgpl_1_1json_html_a70f6d21814412fcd39b0e375a65036c7"><div class="ttname"><a href="classgpl_1_1json.html#a70f6d21814412fcd39b0e375a65036c7">gpl::json::getArraySize</a></div><div class="ttdeci">int getArraySize(std::string par)</div><div class="ttdoc">获取json数组对像的大小 </div></div>
<div class="ttc" id="classgpl_1_1json_html_a22bb7bec211151a7e7ab7dfbc7b4698f"><div class="ttname"><a href="classgpl_1_1json.html#a22bb7bec211151a7e7ab7dfbc7b4698f">gpl::json::getItemDate</a></div><div class="ttdeci">void getItemDate(int &amp;date, std::string par)</div><div class="ttdoc">返回指定路径下面的数据 </div></div>
<div class="ttc" id="classgpl_1_1json_html_a75318267cb1a99e8c027e14eac07dd8f"><div class="ttname"><a href="classgpl_1_1json.html#a75318267cb1a99e8c027e14eac07dd8f">gpl::json::~json</a></div><div class="ttdeci">virtual ~json()</div><div class="ttdoc">析构函数 </div></div>
<div class="ttc" id="classgpl_1_1json_html_ac93597079b396af3190b5ccbce78b925"><div class="ttname"><a href="classgpl_1_1json.html#ac93597079b396af3190b5ccbce78b925">gpl::json::addItem</a></div><div class="ttdeci">bool addItem(std::string par, char *n, char *v)</div><div class="ttdoc">添加键值对 </div></div>
<div class="ttc" id="classgpl_1_1json_html_a39679378dbd5a4efaf7039b4610b7eaf"><div class="ttname"><a href="classgpl_1_1json.html#a39679378dbd5a4efaf7039b4610b7eaf">gpl::json::jsonToString</a></div><div class="ttdeci">bool jsonToString(std::string &amp;jsonsrc)</div><div class="ttdoc">将json对像转换成string </div></div>
<div class="ttc" id="classgpl_1_1json_html_ad21f79b3aec5cd85ae54ff5fa0c81ee8"><div class="ttname"><a href="classgpl_1_1json.html#ad21f79b3aec5cd85ae54ff5fa0c81ee8">gpl::json::addUnNameObject</a></div><div class="ttdeci">bool addUnNameObject(std::string par)</div><div class="ttdoc">添加无名对像，只适合数组 </div></div>
<div class="ttc" id="classgpl_1_1json_html_a9bba408957bfe134cde76ca012060ddb"><div class="ttname"><a href="classgpl_1_1json.html#a9bba408957bfe134cde76ca012060ddb">gpl::json::addNameObject</a></div><div class="ttdeci">bool addNameObject(std::string par, char *on)</div><div class="ttdoc">添加有名对像，适合对像和数组 </div></div>
<div class="ttc" id="classgpl_1_1json_html_a6a63d4da6102b133db62dde7196a9d31"><div class="ttname"><a href="classgpl_1_1json.html#a6a63d4da6102b133db62dde7196a9d31">gpl::json::json</a></div><div class="ttdeci">json()</div><div class="ttdoc">构造函数 </div></div>
<div class="ttc" id="classgpl_1_1json_html_a3ca90bb2f355760a46267eb8cee74a81"><div class="ttname"><a href="classgpl_1_1json.html#a3ca90bb2f355760a46267eb8cee74a81">gpl::json::addNameArray</a></div><div class="ttdeci">bool addNameArray(std::string par, char *an)</div><div class="ttdoc">添加有名字数组,适合对像和数组 </div></div>
<div class="ttc" id="classgpl_1_1json_html_a1292cb00891eb064bcb11600debf917c"><div class="ttname"><a href="classgpl_1_1json.html#a1292cb00891eb064bcb11600debf917c">gpl::json::jsonToFile</a></div><div class="ttdeci">bool jsonToFile(std::string filename)</div><div class="ttdoc">写文件数据 </div></div>
<div class="ttc" id="classgpl_1_1json_html_ad7b6eb75816673fa59799f6e3b746a3f"><div class="ttname"><a href="classgpl_1_1json.html#ad7b6eb75816673fa59799f6e3b746a3f">gpl::json::parseJson</a></div><div class="ttdeci">bool parseJson(std::string filename, int encoded=0)</div><div class="ttdoc">解析json </div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
